from services.chat.knowledge import get_vector_store

def search():
    v = get_vector_store()

    docs1 = v.similarity_search("mate70",k=3)
    print(f"相似性搜索：{docs1}")
    docs2 = v.similarity_search_with_relevance_scores("mate70",k=3)
    print(f"相似性搜索，分数[0,1]，越接近1则越相似，返回相关分数：{docs2}")
    for doc in docs2:
        document,score = doc
        print(f"相似性搜索，分数[0,1]，越接近1则越相似，返回相关分数：{score}，文档内容：{document.page_content}")
    docs3 = v.similarity_search_with_score("mate70",k=3)
    print(f"相似性搜索，分数越低相似度越高，返回分数：{docs3}")
    for doc in docs3:
        document,score = doc
        print(f"相似性搜索，分数越低相似度越高，返回分数：{score}，文档内容：{document.page_content}")
